<!DOCTYPE html>
<html>

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  <meta name="format-detection" content="telephone=no"/>
  <meta charset="utf-8">
  <title>宁家鲜生</title>
  <link rel="stylesheet" type="text/css" href="static/css/aui-slide.css"/>
  <link rel="stylesheet" href="static/css/fonts/iconfont.css"/>
  <link rel="stylesheet" href="static/css/aui.min.css"/>
  <script>
    // window.addEventListener("message", function (event) {

    // 	document.cookie = "sessionId=" + event.data + ";expires=date";
    // }, false);
  </script>
</head>

<body>
<div id="app"></div>
<!-- built files will be auto injected -->
<!-- <script type="text/javascript" src="static/script/lib/aui-dialog.js"></script> -->
<script>
  var u = navigator.userAgent;
  console.log("使用的设备", u);
  var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android
  var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
  var isWindows = u.indexOf("Windows") > -1; //判断是否是Windows
  var isMac = u.indexOf("Mac") > -1; //判断是否是Mac
  var isXiangpu = u.indexOf("xiangpu") > -1;//判断是否在象谱内打开
  var isScript = document.querySelector(".isScript")
  if (isXiangpu && !isScript) {
    if (isiOS) {
      var scriptLabel = document.createElement("script")
      scriptLabel.setAttribute("src", 'static/script/cordova/ios/cordova.js')
      scriptLabel.setAttribute("class", 'isScript')
      console.log(scriptLabel)
      document.body.appendChild(scriptLabel)
    } else if (isAndroid) {
      var scriptLabel = document.createElement("script")
      scriptLabel.setAttribute("src", 'static/script/cordova/android/cordova.js')
      scriptLabel.setAttribute("class", 'isScript')
      console.log("Android---", navigator.userAgent);
      console.log(scriptLabel)
      document.body.appendChild(scriptLabel)
    }
    else if (isWindows || isMac) {
      //Mac或者是windows，默认不作处理
    } else {
      //如果读不到系统标识，默认当做android处理
      var scriptLabel = document.createElement("script")
      scriptLabel.setAttribute("src", 'static/script/cordova/android/cordova.js')
      scriptLabel.setAttribute("class", 'isScript')
      console.log("else---", navigator.userAgent);
      console.log(scriptLabel);
      document.body.appendChild(scriptLabel)
    }
  }
</script>
<script>

  function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
  }

  function oldLogin() { 
    var sessionId = GetQueryString("sessionId");
    if (sessionId != null && sessionId.toString().length > 1) {
      console.log('app_sessionid', sessionId);
      localStorage.setItem('sessionId', sessionId);
    }else{  
      if(window.location.hash.indexOf('profile')==-1){
        localStorage.setItem('sessionId', null);
      }
    }
   }

   function newLogin() { 

    }

    //新旧版本登录判断
  // if (navigator.userAgent.indexOf('iPhone') > -1 && navigator.userAgent.indexOf("xiangpu") > -1) {
  //   cordova.exec(function (res) {
  //     var Version = Number(String(res).split('.').join(''));
  //     Version == 102 ? oldLogin() : newLogin();
  //   }, function (res) {
  //     newLogin();
  //   }, "CommonPlugin", "getAppVersion", []);

  // } else if (navigator.userAgent.indexOf('Android') > -1 && navigator.userAgent.indexOf("xiangpu") > -1) {
  //   cordova.exec(function (res) {
  //     var Version = Number(String(res).split('.').join(''));
  //     Version <= 124 ? oldLogin() : newLogin();
  //   }, function (res) {
  //     newLogin();
  //   }, "AppInfo", "getVersion", []);
  // } else if (navigator.userAgent.indexOf("xiangpu") === -1) {
  //    newLogin();
  // }

</script>
   <!-- <script src="static/script/vconsole.min.js"></script> -->
<script>
    // var v = new VConsole();
</script>   
</body>
<!-- uyv cg -->
</html>
